package com.happyfamily.springboot.crowdsourcingplatform.dao.pan;

import com.happyfamily.springboot.crowdsourcingplatform.base.result.Results;
import com.happyfamily.springboot.crowdsourcingplatform.model.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @Author Administrator
 * @create 2020/02/29 12:19
 */
@Mapper
public interface SuccessCaseDao
{



	/**
	 * 查询所有订单状态为已完成的订单数据总的条数
	 * @return
	 */
	@Select("select count(*) from orders where pid =4")
	Long countAllNeeOrders();


	/**
	 * 查询所有订单状态为已完成的订单数据
	 * @param offset
	 * @param limit
	 * @return
	 */
	@Select("select * from orders where pid =4 order by ostarttime desc  limit #{offset},#{limit}")
	List<Orders> getAllOrdersByPage(@Param("offset") Integer offset, @Param("limit") Integer limit);


	/**
	 * 根据订单id修改成功案例字段
	 * @param oid
	 * @param successcase
	 * @return
	 */
	@Update("update orders set successcase= #{successcase} where oid=#{oid}")
	int updateTahil(Integer oid, int successcase);

	/**
	 * 获取所有的成功案例的数据
	 * @return
	 */
	@Select("select * from orders where successcase= 2 order by ostarttime desc limit 0,10")
	List<Orders> getFindOrdser();
}
